<template>
   <div>
     <zm-form :model="searchForm" ref="searchForm" inline>
        <zm-form-item prop="orderNo">
          <zm-input
            v-model="searchForm.orderNo"
            placeholder="输入销售单号查询"
            class="w150"
          ></zm-input>
        </zm-form-item>
         <zm-form-item>
          <zm-button @click="onSearch" t="search"></zm-button>
          <zm-button @click="onReset" t="reset"></zm-button>
        </zm-form-item>
     </zm-form>
     <zm-table-data
        :data="tableParams.data"
        :columns="columns"
        :fetch="loadList"
        :table-params="tableParams"
        :show-page="true"
      >
      </zm-table-data>
   </div>
</template>

<script>
import tableMixin from '@/mixins/zmTableMixin'
import { columns } from './const'
import productProgramApis from '@/api/src/productProgram'
export default {
  name: 'SaleOrder',
  components: { },
  mixins: [tableMixin],
  props: {
    infoData: {
      type: Object,
      default () {
        return {}
      }
    }
  },
  data () {
    return {
      searchForm: {
        orderNo: ''
      }
    }
  },
  computed: {
    columns () {
      return columns(this)
    }
  },
  watch: {},
  created () {
  },
  methods: {
    async loadList () {
      const params = {
        programId: this.infoData.id,
        type: this.infoData.type
      }
      const _res = await productProgramApis.getPageListBySaleOrder(
        this.assignQuery({...this.searchForm, ...params})
      )
      this.initialTableData(_res.list, _res.count)
    }
  }
}
</script>

<style scoped lang='scss'>

</style>
